﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace BanVeChuyenBay.DAL
{
    class DAL_KetNoi
    {
        public SqlConnection connect()
        {
            SqlConnection con = null;
            try {
                //
                string path = Directory.GetCurrentDirectory();
                path = Directory.GetParent(path).ToString();
                path = Directory.GetParent(path).ToString() + @"\DataBase\BANVECHUYENBAY.mdf";

                string ketnoi = @"Data Source=(LocalDB)\v11.0; AttachDbFilename=" + path +"; Integrated Security=True;Connect Timeout=30";
                con = new SqlConnection(ketnoi);
                con.Open();
            }
            catch
            {
                return null;
            }
            return con;
        }
    }
}
